package controllers;

import java.util.Collections;
import java.util.Set;

import models.Establishment;
import models.FoodCourt;
import models.MenuSection;
import models.Owner;
import models.SpotConfigurationAttribute;
import models.Telephone;
import play.data.Upload;
import play.mvc.Controller;
import play.mvc.With;

@With(Secure.class)
public class Spot extends Controller {
	public static void list(long establishmentId) {
		Establishment establishment = Establishment.findById(establishmentId);
		render(establishment);
	}

	public static void blank(long establishmentId) {
		render(establishmentId);
	}

	public static void show(long id, long establishmentId) {
		SpotConfigurationAttribute attribute = SpotConfigurationAttribute.findById(id);
		render(attribute, establishmentId);
	}

	public static void delete(long id, long establishmentId) {
		SpotConfigurationAttribute attribute = SpotConfigurationAttribute.findById(id);
		attribute.delete();
		list(establishmentId);
	}

	public static void create(Establishment establishment, SpotConfigurationAttribute attribute) {
		establishment.getSpotConfiguration().getAttributes().add(attribute);
		establishment.save();
		list(establishment.getId());
	}

	public static void save(Establishment establishment, SpotConfigurationAttribute attribute) {
		attribute.save();
		list(establishment.getId());
	}
}
